import { storageName } from '@/config'
import Taro from '@tarojs/taro'

export default {
  namespace: 'app',
  state: {
    ...Taro.getStorageSync(storageName),
  },
  reducers: {
    update(state, { payload }) {
      state = {
        ...state,
        ...payload
      }
      Taro.setStorageSync(storageName, state)
      return { ...state }
    }
  }
}
